#!/usr/bin/make -f

#export DH_VERBOSE=1

# uncomment if dpatch functions required
#include /usr/share/dpatch/dpatch.make

#export DH_PYCENTRAL=nomove
PYVERS=$(shell pyversions -r debian/control)

build: build-stamp

#build-stamp: patch-stamp
build-stamp:
	dh_testdir
	for python in $(PYVERS); \
		do $$python setup.py build; \
	done
	touch build-stamp

#clean: unpatch
clean: 
	dh_testdir
	for python in $(PYVERS); \
		do $$python setup.py clean; \
	done
	rm -rf build-stamp build
	dh_clean
	rm `find . -name '*.pyc'`
	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs
	for python in $(PYVERS); \
		do $$python setup.py install --root=$(CURDIR)/debian/pybookshelf --no-compile;\
	done

	#dh_install -i  usr/lib/$$python/site-packages/pybookshelf ; \
	#/usr/bin/python2.5 setup.py install --no-compile --root $(CURDIR)/debian/pybookshelf

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs 
	dh_installdocs
	dh_strip
	dh_compress
	dh_fixperms
	dh_pycentral
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch: build install

binary: binary-indep binary-arch

.PHONY: build clean binary-indep binary-arch binary install
